* fileio.c (Finsert_file_contents): Avoid double-close.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 25 Jul 2013 07:29:36 +0000 (08:29 +0100)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 25 Jul 2013 07:29:36 +0000 (08:29 +0100)
src/ChangeLog
src/fileio.c

index 72e4daad64e8405152229699807a66b76535b3c7..8d9a1d5146f08b6710e7e9f6319a0fa016383a7f 100644 (file)
@@ -1,3 +1,7 @@
+2013-07-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * fileio.c (Finsert_file_contents): Avoid double-close (Bug#14936).
+
 2013-07-24  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (redisplay_window): Instead of moving point out of
index a19fcd9f66380a33364a6607589d063caa192c70..1350e19ef27268bd9aaeb48a431b5c0c65f04dae 100644 (file)
@@ -3860,7 +3860,11 @@ by calling `format-decode', which see.  */)
       if (same_at_start - BEGV_BYTE == end_offset - beg_offset)
        {
          emacs_close (fd);
-         specpdl_ptr--;
+
+         /* Discard the unwind protect for closing the file, and any
+            unwind protect for restoring point.  */
+         specpdl_ptr = specpdl + fd_index;
+
          /* Truncate the buffer to the size of the file.  */
          del_range_1 (same_at_start, same_at_end, 0, 0);
          goto handled;